package net.zjitc.hashset;

import java.util.HashSet;
import java.util.Iterator;

/**
 * @Author admin
 * @Date 2019/4/2 16:39
 */
public class HashSetTest {
    public static void main(String[] args) {
        Student s1=new Student("张三");
        Student s2=new Student("张三");
        Student s3=new Student("李四");

        HashSet<Student> hashSet=new HashSet<Student>();
        hashSet.add(s1);
        hashSet.add(s2);
        hashSet.add(s3);

        Iterator iterator=hashSet.iterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
            /*能证明无序，但们没有唯一
            * 重写equals方法*/
        }
    }
}
